<template>
  <div class="big_box">
    <header>
      <van-icon name="arrow-left" @click="back" />
      <span>找回密码</span>
    </header>
    <div class="inp">
      <input type="text" v-model="mobile" placeholder="请输入手机号" />
      <span @click="getCode">获取验证码</span>
      <input type="text" v-model="sms_code" placeholder="请输入验证码" />
      <input type="password" v-model="password" placeholder="请输入密码" />
    </div>
    <div>
       <van-button @click="setPassword" class="login" color="#fd6b19" size="large" type="warning">登录</van-button>
    </div>
  </div>
</template>

<script>
import {smsCode,setLogin} from '@/request/http.js'

import { Icon , Button } from "vant";
export default {
  name: "findPassword",
  components: {
    [Icon.name]: Icon,
    [Button.name]: Button,
  },
  directives: {},
  data() {
    return {
       mobile:'',
      sms_code:'',
      password:''
    };
  },
  mounted() {},
  methods: {
    // 返回登录页面
    back() {
      this.$router.push("/login");
    },
    // 1 获取短信验证码
    getCode(){
      smsCode(this.mobile).then(res=>{
        console.log(res)
      })
    },
    // 2 设置密码登录
    setPassword(){
      setLogin(
        this.mobile,
        this.password,
        this.sms_code,
      ).then(res=>{
        console.log(res)
      })
    }
  }
};
</script>

<style lang="scss" scoped>
.big_box {
  position: relative;
  min-height: 650px;
  background: white;
  header {
    width: 100%;
    height: 60px;
    line-height: 60px;
    position: relative;
    .van-icon {
      margin-left: 10px;
    }
    span {
      font-size: 20px;
      color: #595959;
      position: absolute;
      left: 40%;
    }
  }
  .inp{
    position: relative;
    margin-top: 20px;
    span{
       font-size: 14px;
      position: absolute;
      right: 40px;
      top: 12px;
      color: #fd6b19;
    }
  }
  input {
    width: 98%;
    border: none;
    margin: 10px 0;
    height: 30px;
    font-size: 16px;
    color: #c0c0c0;
    box-sizing: border-box;
    padding-left: 30px;
  }
  input::-webkit-input-placeholder {
    color: #c0c0c0;
    border-bottom: 1 px solid #f3f3f3;
  }
   .login {
    width: 80%;
    min-height: 50px;
    position: absolute;
    bottom: 50%;
    left: 10%;
    text-align: center;
    border-radius: 30px;
    overflow: hidden;
  }
}
</style>